#include <iostream.h>
#include <conio.h>
#include <process.h>
int main()
{
	int a,b,c,d,e,f,g,h,i,j,m;

   /*****First Page*****/

   for(j= 1 ; j<=10 ; ++j)
   	clrscr();
      cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t      Day Finder Program" ;
      getch();
      cout	<< "\n\n\n\t\t\t\t\t\t-By Mukund and Fatema";
      getch();
   	clrscr();
      cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t\tLoading   " << "1" << "%";
      getch();
      clrscr();
   	cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t\tLoading   " << j << "%";
   	getch();
   if (j==11)
   	for(j=11 ; j<=25 ; ++j)
      	clrscr();
         cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t\tLoading   " << j << "%";
   		getch();
      if (j==26)
      	for(j=26 ; j<=75 ; ++j)
      		clrscr();
        	 	cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t\tLoading   " << j << "%";
   			getch();
   		if (j==76)
      		for(j=76 ; j<=99 ; ++j)
      			clrscr();
        	 		cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t\tLoading   " << j << "%";
               getch();
               clrscr();
               cout 	<< "\n\n\n\n\n\n\n\n\n\n\t\t\t\tLoading Complete";
   getch();


   /*****Second Page*****/
   clrscr();
  	cout	<<	"\n\t\t*****Welcome To Day Finder Program*****"
   		<< "\n\n\tThis Program is made by Mukund Gohil And Fatema Kapadvanjwala\n\n\n"
   		<<	"\n\tYou are required to enter the option number of the year range."
         << "\n\tYou are then asked to enter last two digit of the year."
         << "\n\tThen enter the month and the date of which you want to find the day."
   		<<	"\n\tThe program will then show you the day of the week as respected date."
   		<<	"\n\n\n\n\n\n\t So go ahead and have fun....\n"
   		<<	"\n\n\t Press any key to continue ....";
   getch();


   /*****Third Page*****/
   start :
	clrscr();
	cout 	<< "\n\t\t\t   Select the year range"
   		<< "\n\t\t\t\t1.\t1700\n\t\t\t\t2.\t1800\n\t\t\t\t3.\t1900\n\t\t\t\t4.\t2000\n\t\t\t\t5.\t2100\n\t\t\t\t6.\t2200\n\t\t\t\t7.\t2300"
         << "\nEnter your choice:";
   cin >> a;
   switch(a)
   {
   	case 1	:	b=4;
      				i=1700;
      				break;
      case 2	:	b=2;
      				i=1800;
                  break;
      case 3	:	b=0;
      				i=1900;
      				break;
      case 4	:	b=6;
      				i=2000;
      				break;
      case 5	:	b=4;
      				i=2100;
      				break;
      case 6	:	b=2;
      				i=2200;
      				break;
      case 7	:	b=0;
      				i=2300;
      				break;
      default	:	cout << "\n\t\t\tEntered Wrong Choice!!!";
                  getch();
      				exit(0);
   }

   cout 	<<	"\nNow Enter the last two digit of the year: ";
   cin >> e;
   	f = e / 4;

   cout 	<< "\nNow Enter the Month Number: ";
   cin	>> c ;
   switch(c)
   {
      case 1		:	m=1;
      					break;
      case 2		:	m=4 ;
      					break;
      case 3 		:	m=4 ;
      					break;
      case 4		:	m=0 ;
      					break;
      case 5  		:	m=2 ;
      					break;
		case 6		:	m=5 ;
      					break;
      case 7		:	m=0 ;
      					break;
		case 8		:	m=3 ;
      					break;
      case 9	  	:	m=6 ;
      					break;
		case 10	  	:	m=1 ;
      					break;
      case 11		:	m=4 ;
      					break;
      case 12		:	m=6 ;
      					break;
		default		:	cout << "\n\t\t\tEntered wrong Month.\n\n\t\t\tPROGRAM IS SHUTTING DOWN.";
                     getch();
      					exit(0);
   }

   cout << "\nNow Finally Enter the date: ";
   cin >> d;
   i += e;
   int leap = i % 4;
		if ( (((leap == 0) && (c==2) && (d>29)) || ((leap != 0) && (c==2) && (d>28)) || (((c==1)||(c==3)||(c==5)||(c==7)||(c==8)||(c==10)||(c==12))&&(d>=32) )) || (((c==4)||(c==6)||(c==9)||(c==11))&&(d>30)) )

   		{
      		cout 	<< "\n\n\t\tYou entered the date which does not exists."
            		<< "\n\t\tPROGRAM IS SHUTTING DOWN.";
      		getch();
      		exit(0);
      	}

   cout << "\n\n\t\tThank you for your co-operation.\n\t\tNow I am going to show the day.\n\t\tPress any Key to CONTINUE...\n\n\t\t\t\t";
   getch();

   g = b + d + e + f + m ;
   h = g % 7;
   switch (h)
   	{	case 0	:	cout 	<< "Saturday";
      					break;
      	case 1	: 	cout 	<< "Sunday";
      					break;
	      case 2   :	cout	<< "Monday";
      					break;
   		case 3	:	cout 	<< "Tuesday";
      					break;
      	case 4	: 	cout 	<< "Wednesday";
      					break;
 	   	case 5   :	cout	<< "Thurday";
      					break;
   		case 6   :	cout	<< "Friday";
      					break;
         default  :	cout << "An Unexpexcted Error has occur";
   	}
   getch();


   /*****Fourth Page*****/
   end :
   clrscr();
   cout << "\n\n\n\n\n\n\n\n\n\n\t\t";
   cout << "   Do you want to enter again ??? ( y / n )";
   char n ;
   cin >> n ;
   if ((n == 'y') || (n == 'Y'))
   	goto start ;
   else if ((n == 'n') || (n == 'N'))
   	exit(0);
   else
   	goto end;

   return 0;
}




